package main

import (
	"fmt"
	"io/ioutil"
	"net/http"
)

/**
  简易的HTTP服务
*/

func sayHello(response http.ResponseWriter, r *http.Request) {
	//读取文件
	data, _ := ioutil.ReadFile("E:\\PersonalCodeHub\\go_code_hub\\go_code_hub\\gin\\src\\demo\\demo1\\hello.txt")
	_, _ = fmt.Fprintln(response, string(data))
}

func main() {
	http.HandleFunc("/hello", sayHello)
	err := http.ListenAndServe("127.0.0.1:8888", nil)
	if err != nil {
		fmt.Printf("http serve failed %v", err)
		return
	}
}
